<html xmlns:th="http://www.thymeleaf.org" lang="en">
<head>
    <meta charset="UTF-8">
    <title>用户管理</title>
    <link href="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/4.5.3/css/bootstrap.min.css" rel="stylesheet">
    <style>
        #table {
            margin-top: 20px;
        }
    </style>
</head>
<body>
<div class="row" id="table" style="width: 99%">
    <a th:href="@{addUser}" style="margin: 0 0 15px 15px">
        <button type="button" class="btn btn-primary">添加</button>
    </a>
    <div class="col-md-12">
        <div class="portlet">
            <div class="category-list">
                <table class="table table-hover">
                    <thead>
                    <tr>
                        <th scope="col">ID</th>
                        <th scope="col">登录用户名</th>
                        <th scope="col">登录密码</th>
                        <th scope="col">用户权限</th>
                        <th scope="col">操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    <tr th:each="user,stats:${users}">
                        <td th:text="${stats.count}"></td>
                        <!--                        <td th:text="${user.id}"></td>-->
                        <td th:text="${user.loginName}"></td>
                        <td th:text="${user.loginPwd}"></td>
                        <td th:text="普通用户" th:if="${user.permission}==0"></td>
                        <td th:text="管理员" th:if="${user.permission}==1"></td>
                        <td>
                            <a th:href="@{updateUser/(id=${user.id})}">修改</a>
                            <a th:href="@{delUser/(id=${user.id})}">删除</a>
                        </td>
                    </tr>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>

<!--分页-->
<nav aria-label="Page navigation example">
    <ul class="pagination">
        <li class="page-item">
            <button class="page-link" aria-label="Previous">
                <span aria-hidden="true">&laquo;</span>
            </button>
        </li>
        <li class="page-item"><a class="page-link">1</a></li>
        <li class="page-item"><a class="page-link">2</a></li>
        <li class="page-item"><a class="page-link">3</a></li>
        <li class="page-item">
            <a class="page-link" aria-label="Next">
                <span aria-hidden="true">&raquo;</span>
            </a>
        </li>
    </ul>
</nav>

</body>
</html>